package com.wut.easyexcel.excel.handler;

import cn.hutool.core.util.StrUtil;
import com.wut.easyexcel.common.enums.SexEnum;
import com.wut.easyexcel.config.AbstractDataListener;
import com.wut.easyexcel.excel.MemberExcel;
import java.util.Set;

public class MemberValidateHandler extends AbstractDataListener<MemberExcel> {

    @Override
    public void validate(MemberExcel data, Set<String> failedMassageSet) {
        if (StrUtil.equals(data.getPhone(), "18793000000")) {
            failedMassageSet.add("手机号错误");
        }
    }

    @Override
    public void processSuccessData(MemberExcel data) {
        // 设置性别
        data.setSex(String.valueOf(SexEnum.getCodeByName(data.getSex())));
    }
}
